package com.example.serviceheadlines.controller;

import com.example.serviceheadlines.service.IUserHeadlinesCollectionService;
import com.tangyuan.common.constant.RedisConstant;
import com.tangyuan.common.result.Result;
import com.tangyuan.model.User;
import com.tangyuan.model.UserHeadlinesCollection;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: user_headlines_collection
 * @Author: jeecg-boot
 * @Date: 2024-03-19
 * @Version: V1.0
 */
@Api(tags = "user_headlines_collection")
@RestController
@RequestMapping("/headlines")
@Slf4j
public class UserHeadlinesCollectionController {
    @Autowired
    private IUserHeadlinesCollectionService userHeadlinesCollectionService;

    /**
     * 用户收藏百家图文
     *
     * @param userHeadlinesCollection
     * @return
     */
    @GetMapping("/headlinesCollection")
    public Result<String> headlinesCollection(@RequestHeader(name = "userId",required = false) Long userId, UserHeadlinesCollection userHeadlinesCollection) {
        userHeadlinesCollection.setUserId(userId);
        return userHeadlinesCollectionService.headlinesCollection(userHeadlinesCollection);
    }
}
